<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 写一个超级类（父类）
        class Person {
            constructor(name,sex){
                this.name = name;
                this.sex = sex;
            }
            sayName(){
                console.log("你好我是"+this.name);
            }
        }
         
        //子类
        // class Student {
        //     constructor(name,sex,age,xuehao){
        //         this.name = name;
        //         this.sex = sex;
        //         this.age = age;   
        //         this.xuehao = xuehao;
        //     }
            
        // }
        class Student extends Person {
            constructor(name,sex,age,xuehao){
                super(name,sex);
                this.age = age;   
                this.xuehao = xuehao;
            }
            
            study(){
                console.log("我喜欢学习");
            }
        }
        
        let xiaoming = new Student("小明","男",10,"1111111")
        let goudan = new Person("狗蛋","男");

        goudan.sayName()
        // goudan.study()
        // console.log(xiaoming);
        // xiaoming.sayName()
        // xiaoming.study()
    </script>
</body>
</html>